package cn.xiaopengstack.domain.activity.service.discount.impl;

import cn.xiaopengstack.domain.activity.model.dto.DiscountCalculateDTO;
import cn.xiaopengstack.domain.activity.service.discount.AbstractDiscountCalculateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author jiangyangang
 */
@Service("ZJ")
@Slf4j
public class ZJCalculateService extends AbstractDiscountCalculateService {

    @Override
    protected BigDecimal doCalculate(DiscountCalculateDTO calculateDTO) {
        log.info("优惠策略折扣计算:{}", calculateDTO.getGroupBuyDiscount().getDiscountType());

        BigDecimal finalPrice = new BigDecimal(calculateDTO.getGroupBuyDiscount().getMarketExpr());

        return coverMinPrice(finalPrice, new BigDecimal("0.01"));
    }
}
